<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath(); //web项目的根路径
			String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>全部设备</title>
<link rel="stylesheet" href="<%=basePath%>static/layui2.4.5/css/layui.css">
<link rel="stylesheet" href="<%=basePath%>static/font-awesome/css/font-awesome.min.css">
<script src="<%=basePath %>static/jquery/jquery.min.js"></script>
<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>

</head>
<body>
<form class="layui-form" action="">
 <div class="layui-form-item">
    <label class="layui-form-label">IMEI:</label>
    <div class="layui-input-inline">
      <input type="text" name="imei" id="imei"  disabled="disabled"style="width:200px;height:50px"   class="layui-input">
    </div>
  </div>
 <div class="layui-form-item">
    <label class="layui-form-label">设备名:</label>
    <div class="layui-input-inline">
      <input type="text" name="deviceName" id="deviceName"  style="width:200px;height:50px"  class="layui-input">
    </div>
  </div>
 
   <div class="layui-form-item">
    <label class="layui-form-label">激活时间:</label>
    <div class="layui-input-inline">
      <input type="text" name="activeTime" id="activeTime" style="width:200px;height:50px" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">到期时间:</label>
    <div class="layui-input-inline">
      <input type="text" name="endTime" id="endTime" style="width:200px;height:50px"  class="layui-input">
    </div>
  </div> 
   <input type="button" button lay-submit lay-filter="go" value="编辑" class="layui-btn">
</form>

	
  
  <script type="text/javascript">
  layui.use('laydate', function(){
	  var laydate = layui.laydate;
	  
	  //执行一个laydate实例
	  laydate.render({
	    elem: '#activeTime'//指定元素
	    ,
	    type: 'datetime'
	  });
	  laydate.render({
		    elem: '#endTime'//指定元素
		    ,
		    type: 'datetime'
		  });
	});
  function child(data){
	  $("#deviceName").val(data.deviceName);
	  $("#imei").val(data.imei);
	  $("#activeTime").val(data.activeTime);
	  $("#endTime").val(data.endTime);
  }
  
 
layui.use('form', function(){
  var form = layui.form;
  form.on('submit(go)', function(data){
   console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}

  $.ajax({  
	type : "get",  //提交方式  
	url : "<%=basePath %>updateDeviceByImei",//路径  
	data : data.field,  
 	  
 	
	success : function(result) { //返回数据根据结果进行相应的处理 
	
		if (result.success) { 
			parent.layer.msg('修改完成',{icon:6});
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
			parent.$(".layui-laypage-btn").click()
			
		} else { 
			layer.alert("修改失败")

		}  
	},
	error:function(result){
		layer.alert("修改失败请重试")
	}
});


  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
});});
</script>

  
  
</body>
</html>
